{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "ename": "AttributeError",
     "evalue": "type object 'str' has no attribute 'decode'",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mAttributeError\u001b[0m                            Traceback (most recent call last)",
      "\u001b[1;32mD:\\temp/ipykernel_18852/1056324418.py\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[0;32m      5\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m      6\u001b[0m \u001b[1;32mfor\u001b[0m \u001b[0mj\u001b[0m \u001b[1;32min\u001b[0m \u001b[0mrange\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mlen\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0ma\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 7\u001b[1;33m     \u001b[0mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mstr\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mdecode\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"a[j]\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
      "\u001b[1;31mAttributeError\u001b[0m: type object 'str' has no attribute 'decode'"
     ]
    }
   ],
   "source": [
    "#2.查找资料，将常用汉字（20000个左右）及其unicode编码（十六进制形式） 打印出来\n",
    "  #要求： 汉字的unicode编码（十六进制形式）的前两位相同的放在同一行，比如：\n",
    "with open(r'C:\\Users\\未来可期\\Desktop\\常用汉字.txt',encoding=\"gbk\") as f:\n",
    "        a = f.read()\n",
    "\n",
    "for j in range(len(a)):\n",
    "    print(str.decode(\"a[j]\"))\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#1.在当前工作文件夹下创建50个以test为前缀，不重名的文件夹。\n",
    "\n",
    "import os\n",
    "path = r'D:\\电子知识库\\vescode\\python2.0\\上课-test' \n",
    "a = \"test\" \n",
    "b = list(i for i in range(50))\n",
    "print(b[:10])\n",
    "for j in range(len(b)):\n",
    "\n",
    "    os.mkdir(path + './'+a+str(b[j]))\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3.9.7 ('base')",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.7"
  },
  "orig_nbformat": 4,
  "vscode": {
   "interpreter": {
    "hash": "2dbe5485cf12282196b80a8ac362415f1d4830d1445e2229f35f94c570ef032e"
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
